function keyCtrlAndOrEnter() {
	if (event.ctrlKey && event.keyCode == 13) {
		event.returnValue = false;
		event.cancel = true;
		document.getElementById("chat").value = document
				.getElementById("chat").value
				+ '\n';
		return;
	}
	if (event.keyCode == 13) {
		event.returnValue = false;
		event.cancel = true;
		document.getElementById("send").click();
		return;
	}
}
function quit(){
	$.get("QuitServlet",function(data){
		if(data=="success"){
			alert("退出成功");
			window.location.href="Login.html";
		}
		else{
			alert("退出失败");
		}
	},"text");
}
function getUserList(){
	$.get("UserListServlet",function(data){
		var users =data.split(",");
		var dom ="";
		dom=users.join("<br>");
		$("#userList").html(dom);
	},"text");
}
function getMessage(){
	$.get("GetMessageServlet",function(data){
		var messages=data.split("||");
		var dom=messages.join("<br>");
		$("#message").html(dom);
	},"text");
}

function doall(){
	getUserList();
	getMessage();
}
$(document).ready(function(){
	doall();
});

function sendChat(){
	/*	var u=$.cookie("loginuser");*/
		var content =$("#chat").val();
		$.get("SendMessageServlet","message="+content,function(data){
			$("#chat").val("");
			/*$("#message").html($("#message").html()+"<br>"+content+"<br>");*/
		});
	}
setInterval(doall,500);